#pragma once
class CAudioNode
{
public:
	CAudioNode(void);
	virtual ~CAudioNode(void);

	//! Start the node generation
	virtual void Start() = 0;

	//! Cause one sample to be generated
	virtual bool Generate() = 0;

	//! Get the sample rate in samples per second
	double GetSampleRate() { return mSampleRate; }

	//! Get the sample period in seconds
	double GetSamplePeriod() { return mSamplePeriod; }
	
	//! Get the beats per minute of the current audio clip
	double GetBPM() { return mBPM; }

	//! Set the sample rate
	void SetSampleRate( double aS ) { mSampleRate = aS; mSamplePeriod = 1/aS; }

	//! Set the sample rate
	void SetBeatsPerMinute( double aBpm ) { mBPM = aBpm; }

	//! Access a generated audio frame
	const double *Frame() { return mFrame; }
	
	//! Access one channel of a generate audio frame
	double Frame( int aC ) { return mFrame[aC]; }



protected:
	double mSampleRate;
	double mSamplePeriod;
	double mFrame[2];
	double mBPM;
};

